home *** CD-ROM | disk | FTP | other *** search
/ Just Call Me Internet / Just Call Me Internet.iso / prog / atari / c / du_lib / messages.c < prev    next >
C/C++ Source or Header  |  1995-07-10  |  2KB  |  94 lines

  1. /*
  2.   DU_LIB v2
  3.   Gem Window Management & Dialog Library For Lattice C
  4.   ½1994, by Craig Graham.
  5.   
  6.   Based on the DU_LIBv1 Library for HiSoft Basic.
  7. */
  8.  
  9. /*
  10.   AES Messaging Routines
  11. */
  12.  
  13. #include "dulib.h"
  14.  
  15.  
  16. /* Update a window by sending ourselves a WM_REDRAW message via GEM.*/
  17. int update_window(short wind_handle)
  18. {
  19.     short p;
  20.     short x,y,w,h;
  21.     
  22.     for(p=0; p<9; messB[p++]=0);
  23.     
  24.     messB[0]=WM_REDRAW;
  25.     messB[3]=wind_handle;
  26.  
  27.     wind_get(wind_handle,WF_CURRXYWH,&x,&y,&w,&h);
  28.     messB[4]=x; messB[5]=y;
  29.     messB[6]=w; messB[7]=h;
  30.     
  31.     return appl_write(AESid,16,messB);
  32. }
  33.  
  34. /* Send ourselves a control message via GEM.*/
  35. int I_send_message(short wind_handle, short msg)
  36. {
  37.     short p;
  38.     
  39.     for(p=0; p<9; messB[p++]=0);
  40.  
  41.     messB[0]=msg;
  42.     messB[3]=wind_handle;
  43.     return appl_write(AESid,16,messB);
  44. }
  45.  
  46. /*Send redraw messages to all our windows for the area (sx,sy,sw,sh)*/
  47. int send_redraw(short sx, short sy,short sw,short sh)
  48. {
  49.     short m,ha;
  50.                     
  51.     for(ha=0; ha<9; messB[ha++]=0);
  52.     messB[0]=WM_REDRAW;
  53.  
  54.     messB[4]=sx;messB[5]=sy;
  55.     messB[6]=sw+5;messB[7]=sh+5;
  56.     
  57.     for(m=0; m<max_windows; m++)                    /*Send redraw messages to all our other windows*/
  58.     {
  59.         if (windows[m].window_type!=wt_null)
  60.         {
  61.             messB[3]=m;
  62.             appl_write(AESid,16,messB);
  63.         }
  64.     }
  65.     return 0;
  66. }
  67.  
  68. int custom_update_window(short wind_handle)
  69. {
  70.     short p;
  71.     short x,y,w,h;
  72.     
  73.     for(p=0; p<9; messB[p++]=0);
  74.     
  75.     messB[0]=WM_CUSTOM_REDRAW;
  76.     messB[3]=wind_handle;
  77.  
  78.     wind_get(wind_handle,WF_CURRXYWH,&x,&y,&w,&h);
  79.     messB[4]=x; messB[5]=y;
  80.     messB[6]=w; messB[7]=h;
  81.     
  82.     return appl_write(AESid,16,messB);
  83. }
  84.  
  85. /* XACC2 support */
  86.  
  87. /* Set a callback routine to handle any ACC_TEXT messages */
  88.  
  89. short Set_XaccTextHandler(CallBack c)
  90. {
  91.     XaccTextHandler=c;
  92.     return 1;
  93. }
  94.